home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Reference Guide
/
C-C++ Interactive Reference Guide.iso
/
c_ref
/
csource3
/
155_01
/
treeinit.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-10-09
|
737b
|
35 lines
#include <stdio.h>
#include "btree.h"
/* This program initializes a file as a valid key file. This
* program must be used to set-up key files properly.
*/
main()
{
extern char instr[];
FILE *fopen(), *fd;
char filename[20];
struct keyinfo fileinfo;
printf("\n\nName of key file to initialize: ");
gets(filename);
printf("\n\nLength of Key: ");
gets(instr);
fileinfo.keylength = atoi(instr);
if ((fd = fopen(filename, "w")) != NULL) {
fprintf(fd,"%c%2d%5ld%5ld%5ld%c",
'~',fileinfo.keylength,1L,0L,0L,'~');
fclose(fd);
}
else {
BELL
printf("\nCan't open file %s\n", filename);
}
exit(0);
}